using IQIGame.Onigao.Framework;

namespace IQIGame.Onigao.GamePlay
{
    public class ConditionSystemUtil
    {
        public static (bool, int) Check(int conditionCid)
        {
            var cfgCondition = TableCenter.condition.Get(conditionCid);
            var condType = (ConditionPropFetcherType)cfgCondition.Type;
            if (condType != ConditionPropFetcherType.CurPlayer)
            {
                LogGame.LogError("系统条件只支持类型(Condition.Type == 2)");
                return (false, 0);
            }
            (bool, int) result;
            var blackboard = ClassPool<ConditionBlackboard>.Get();
            {
                blackboard.curPlayer = GamePlayerCondFetcher.Instance;
                result = ConditionModule.Instance.Check(conditionCid, blackboard);
            }
            ClassPool<ConditionBlackboard>.Put(blackboard);
            return result;
        }
    }
}
